package com.example.sm.mycook;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import static com.example.sm.mycook.R.id.address_name;
import static com.example.sm.mycook.R.id.address_path;
import static com.example.sm.mycook.R.id.address_phone;
import static com.example.sm.mycook.R.id.address_type;

public class SettingsActivity extends AppCompatActivity implements View.OnClickListener {

    private ImageView mAddressBack;
    private EditText mAddressName;
    private EditText mAddressPhone;
    private TextView mAddressAddress;
    private EditText mAddressPath;
    private EditText mAddressType;
    private Button mBaocun;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_settings);
        initView();
        Intent intent = getIntent();
        String name = intent.getStringExtra("name");
        String phone = intent.getStringExtra("phone");
        String address = intent.getStringExtra("address");
        String path = intent.getStringExtra("path");
        String types = intent.getStringExtra("types");
        mAddressName.setText(name);
        mAddressPhone.setText(phone);
        mAddressAddress.setText(address);
        mAddressType.setText(types);
        mAddressPath.setText(path);

    }

    private void initView() {
        mAddressBack = (ImageView) findViewById(R.id.address_back);
        mAddressName = (EditText) findViewById(address_name);
        mAddressPhone = (EditText) findViewById(address_phone);
        mAddressAddress = (TextView) findViewById(R.id.address_address);
        mAddressPath = (EditText) findViewById(address_path);
        mAddressType = (EditText) findViewById(address_type);
        mBaocun = (Button) findViewById(R.id.baocun);

        mAddressBack.setOnClickListener(this);
        mBaocun.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.address_back:
                finish();
                break;
            case R.id.baocun:
                finish();
                break;
        }
    }

}
